<?php
/**
 * XIE--Scorpion
 *
 * 用户操作
 */
namespace App\Models\Admin;

use DB,Session,Redirect;
use Illuminate\Database\Eloquent\Model;

class Resume extends Model
{
	protected $table = 'jianli_info';
    public $timestamps = false;

	/*
     *简历列表   
     */
    static function resumeList()
    {
        $list=DB::table('jianli_info')
        ->join('info','info.x_id','=','jianli_info.x_id')
        ->join('work','work.w_id','=','jianli_info.w_id')
        ->join('work_experience','work_experience.l_id','=','jianli_info.l_id')
        ->join('project_experience','project_experience.xm_id','=','jianli_info.xm_id')
        ->join('school','school.s_id','=','jianli_info.s_id')
        ->join('self','self.sh_id','=','jianli_info.sh_id')
        ->join('homework','homework.h_id','=','jianli_info.h_id')
        ->paginate(5);

        if($list){
            foreach($list as $k=>$v){
                //
                if($v->e_id){
                    $e_id=$v->e_id;
                    $rows=DB::table('enterprise')->where('enterprise_id',$e_id)->get();
                    $list[$k]->enterprise=$rows[0];
                }
            }
        }
        

        return $list;
    }

    /*
     *获取特定的公司简历
     *
     * $id 公司id
     */
    static function resumeEnterprise($id)
    {

        $list=DB::table('jianli_info')
        ->join('info','info.x_id','=','jianli_info.x_id')
        ->join('work','work.w_id','=','jianli_info.w_id')
        ->join('work_experience','work_experience.l_id','=','jianli_info.l_id')
        ->join('project_experience','project_experience.xm_id','=','jianli_info.xm_id')
        ->join('school','school.s_id','=','jianli_info.s_id')
        ->join('self','self.sh_id','=','jianli_info.sh_id')
        ->join('homework','homework.h_id','=','jianli_info.h_id')
        ->where('e_id',$id)
        ->orderBy('jianli_info.addtime','desc')->paginate(5);
        
        if($list){

        }else{
            $list='';
        }

        return $list;
    }

    

}